<?php
namespace App\Controller;
class IndexController extends BaseController
{
    /**
     * 首页
     */
    public function index(){
        $model = D('App/Base');
        $page_title = C("TITLE");

        //股票资讯
        $gupiao = M('Article a')->field('a.id,a.title,a.add_time')->join('left join '.C('DB_PREFIX').'Articles_category b on a.cat_id=b.id')->where('b.cat_name="股票资讯"')->limit(7)->select();

        //操盘资讯
        $caopan = M('Article a')->field('a.id,a.title,a.add_time')->join('left join '.C('DB_PREFIX').'Articles_category b on a.cat_id=b.id')->where('b.cat_name="操盘资讯"')->limit(7)->select();
        // md($gupiao);

        $this->assign(array(
            'gupiao'    => $gupiao,
            'caopan'    => $caopan,
            'friend_link'    => true,
        ));
        $this->setPageInfo("{$page_title['title']}", "{$page_title['keyword']}", "{$page_title['desc']}", 1);
        $this->display();
    }

    /* 关于我们 */
    public function abouts(){
        $id = I('get.id','0','intval');
        $data = array(
                'about' => M('Article')->where(array('title'=>array('eq','关于我们'),'site_id'=>array('eq',33)))->getField('id'),
                'join' => M('Article')->where(array('title'=>array('eq','加入我们'),'site_id'=>array('eq',33)))->getField('id'),
                'contact' => M('Article')->where(array('title'=>array('eq','联系我们'),'site_id'=>array('eq',33)))->getField('id'),
            );
        $id = empty($id) ? $data['about'] : $id;
        $content = M('Article')->field('content')->find($id);
        $this->assign('content', $content);
        
        $this->assign('data', $data);
        $this->display();
    }
}